\section{Controller Performance}
\label{sec:results:performance}

\newif\ifmakeplots
\makeplotstrue


In order to test the controller performance of the various control implementations, a single benchmark disturbance case was chosen.
It is designed to mimic a typical disturbance downstream of the system such as the shutdown of another compressor.
The disturbances used were as follows:

\begin{itemize}
  \item \textbf{parallel}: common tank discharge valve (\g{ut}) 70\% -> 40\% open;
  \item \textbf{serial}: downstream compressor discharge valve (\gii{ud}) 39\% -> 29\% open.
\end{itemize}
In the following plots, the disturbances are persistent and applied at \u{50}{s}, after the system has reached steady state.

The distributed controllers in this section were implemented using 3 controller iterations. 
As discussed in \sect{mpc:distributed:stopping}, this number was determined sufficient for convergence of the applied inputs.


\subsection{Parallel System}
\label{sec:results:performance:parallel}


The time response of each controller for the parallel system is shown in \fig{res:parallel-timeresp}.
The responses obtained using each of the three controllers are virtually identical -- in this case, using a distributed control approach has no performance penalty and a potential decrease in computational cost (see below).
The controller weights used to generate these results are summarized in \tab{res:parallel-weights}.

\begin{table}
  \centering
  \footnotesize
  \caption[Controller weights used for the parallel system.]{Controller weights used for the parallel system. Surge distance is normalized by a factor of 1000 to have similar weight ranges.}
  \begin{tabular}{lccccc}
    \toprule
    & & Centralized & Coop. & Non-coop. 1 & Non-coop. 2 \\
    \midrule
    \multirow{2}{*}{Torque} & \gi{torque}  & 20 & 19 & 22 & 0 \\
    & \gii{torque}  & 20  & 19 & 0 & 22 \\
    \multirow{2}{*}{Recycle valve} & \gi{ur}  & 200 & 190 & 220 & 0 \\
    & \gii{ur}  & 200 & 190 & 0 & 220 \\
    \multirow{2}{*}{Surge distance}& \gi{sd}  & 1 & 1 & 1 & 0 \\
    & \gii{sd}  & 1 & 1 & 0 & 1 \\
    % \multirow{2}{*}{Compressor output pressure}& \gi{pd}  & 0 & 0 & 0 & 0 \\
    % & \gii{pd}  &0 & 0 & 0 & 0 \\
    Common tank pressure & \g{pt}  & 0.5 & 0.42 & 0.6 & 0.6 \\
    \bottomrule
  \end{tabular}
  \label{tab:res:parallel-weights}
\end{table}



\ifmakeplots

\begin{figure}
  {\centering\large\textbf{Parallel System}\\Both Compressors\\[1em]}
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/parallel_p.tex}
    \normalsize
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/parallel_sd.tex}
    \normalsize
  \end{subfigure}
  \\
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/parallel_td.tex}
    \normalsize
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/parallel_ur.tex}
    \normalsize
  \end{subfigure}
  \caption[Time response of parallel system.]{Comparison of time responses of centralized and distributed controllers. Distributed controllers use 3 solver iterations. The disturbance applied is a closing of the common tank discharge valve from 70\% to 40\% at time \u{50}{s}.}
  \label{fig:res:parallel-timeresp}
\end{figure}

\begin{figure}
  \centering
  \footnotesize
  \input{results/figs/parallel_sd_zoom.tex}
  \normalsize
  \caption[Zoomed view of surge distance time response of parallel system.]{Zoomed view of surge distance time response given in \fig{res:parallel-timeresp}. The disturbance applied is a closing of the common tank discharge valve from 70\% to 40\% at time \u{50}{s}.}
  \label{fig:res:parallel-sd-zoom}
\end{figure}

\fi

The disturbance applied has the effect of decreasing the mass flow out of, and increasing the pressure in, the common discharge tank, thus pushing both compressors toward surge.
At this point, the recycle valve opens but with a \u{2}{s} delay.
During this delay period, the controller also increases the torque applied to the driver, which increases the mass flow through the compressor, quickly pulling it away from the surge line.

The increased torque from both compressors further increases the pressure in the common discharge tank, though the pressure reacts on a much slower time scale than the surge distance.
Once the recycle valve begins to take effect, the torque applied to both compressors is decreased by the controller in order to bring the discharge pressure back to its setpoint.

The integral squared error (ISE) and integral absolute error (IAE) are shown in \tab{res:performance:par-ise} for all controllers.

\begin{table}
  \centering
  \caption{Integral squared error (ISE) and integral absolute error (IAE) measures for parallel controllers.}
  \begin{tabular}{ccccccc}
    \toprule
    & \multicolumn{2}{c}{Centralized} & \multicolumn{2}{c}{Cooperative} & \multicolumn{2}{c}{Non-cooperative}\\
    \midrule
    & ISE & IAE & ISE & IAE &ISE & IAE \\
    \g{torque} & 0.0026 &    0.027 &   0.0026 &    0.028 &   0.0026 &    0.028 \\
    \g{ur} &  0.00012 &   0.0057 &  0.00011 &   0.0056 &  0.00012 &   0.0059 \\
    \g{sd} &    0.035 &    0.057 &    0.033 &    0.054 &    0.036 &    0.059 \\
    \g{pt} &   0.0023 &    0.025 &   0.0024 &    0.026 &   0.0023 &    0.025 \\
    \bottomrule
  \end{tabular}
  \label{tab:res:performance:par-ise}
\end{table}

\subsection{Serial System}
\label{sec:results:performance:serial}

The time response of the serial system is shown in \fig{res:serial-timeresp}.
A zoomed view of the initial surge distance response is shown in \fig{res:serial-sd-zoom}.
The controller weights used to generate these results are summarized in \tab{res:serial-weights}.

\begin{table}
  \centering
  \caption[Controller weights used for the serial system.]{Controller weights used for the serial system. Surge distance is normalized by a factor of 1000 to have similar weight ranges.}
  \footnotesize
  \begin{tabular}{lccccc}
    \toprule
    & & Centralized & Coop. & Non-coop. 1 & Non-coop. 2 \\
    \midrule
    \multirow{2}{*}{Torque} & \gi{torque}  & 20 & 41 & 30 & 0 \\
    & \gii{torque}  & 20  & 25 & 0 & 30 \\
    \multirow{2}{*}{Recycle valve} & \gi{ur}  & 250 & 500 & 500 & 0 \\
    & \gii{ur}  & 250 & 500 & 0 & 500 \\
    \multirow{2}{*}{Compressor output pressure}& \gi{pd}  & 0.2 & 0.75 & 1.9 & 0 \\
    & \gii{pd}  & 1 & 1.5 & 0 & 1.9 \\
    \multirow{2}{*}{Surge distance}& \gi{sd}  & 1 & 4 & 3 & 0 \\
    & \gii{sd}  & 8 & 8 & 0 & 3 \\
    \bottomrule
  \end{tabular}
  \label{tab:res:serial-weights}
\end{table}

In contrast to the parallel case, differences in the controller response and performance can be observed for each of the control approaches.
The cooperative controller response is qualitatively similar to that of the centralized controller.
It is, however, somewhat less aggressive in its regulation of the output pressure, evidenced by its less extreme change from high to low torque in the downstream compressor and faster return to the steady-state torque value, as shown in \fig{res:serial-timeresp:td2}.
As a result, the output pressure of the downstream compressor has a much lower overshoot than either the centralized or non-cooperative controller.

Similarly, in the upstream compressor, the cooperative controller's torque input -- shown in \fig{res:serial-timeresp:td1} -- is smoother than that of the centralized controller with no uptick near \u{70}{s}, and a faster convergence of both inputs to their steady-state values.
Accordingly, the upstream compressor's output pressure also converges faster for the cooperative controller than for the centralized one.
The surge distances of the centralized and cooperative controllers, however, show an almost identical response for the downstream compressor and a similar response upstream, though that of the cooperative controller has a greater increase near \u{58}{s} (see \fig{res:serial-sd-zoom}).

The non-cooperative controller response has a much different characteristic than that of the centralized controller.
As shown in \refs{fig:res:serial-timeresp:td1,fig:res:serial-timeresp:td2}, there is no significant initial increase in the torque input to either compressor when the disturbance is applied; as a result, both compressors are pushed further towards surge than in the centralized or cooperative case, and the surge distances are also slower to converge.
The maximum disturbance to the output pressures of both compressors for the non-cooperative controller is accordingly reduced by approximately 40\% when compared to the centralized case.

The integral squared error (ISE) and integral absolute error (IAE) are shown in \tab{res:performance:ser-ise} for all controllers.

\begin{table}
  \centering
  \caption{Integral squared error (ISE) and integral absolute error (IAE) measures for serial controllers.}
  \begin{tabular}{ccccccc}
    \toprule
    & \multicolumn{2}{c}{Centralized} & \multicolumn{2}{c}{Cooperative} & \multicolumn{2}{c}{Non-cooperative}\\
    & ISE & IAE & ISE & IAE &ISE & IAE \\
    \midrule
    \gi{torque} &   0.0012 &    0.012 &    0.001 &   0.0079 &   0.0015 &    0.019\\
    \gi{ur} &  8.6e-05 &   0.0037 &  5.6e-05 &   0.0024 &  0.00011 &   0.0053\\
    \gi{pd} &  0.00096 &    0.011 &   0.0006 &   0.0067 &  0.00081 &    0.014\\
    \gi{sd} &    0.052 &    0.063 &    0.031 &    0.041 &    0.078 &     0.13\\
    \gii{torque} &   0.0027 &    0.016 &  0.00095 &   0.0073 &   0.0017 &    0.021\\
    \gii{ur} &  1.1e-05 &   0.0011 &  2.7e-05 &   0.0016 &  3.2e-05 &   0.0026\\
    \gii{pd} &  0.00047 &   0.0051 &  0.00058 &   0.0049 &  0.00029 &    0.005\\
    \gii{sd} &    0.056 &    0.032 &    0.064 &    0.035 &      0.1 &    0.064\\
    \bottomrule
  \end{tabular}
  \label{tab:res:performance:ser-ise}
\end{table}

\ifmakeplots
\begin{figure}
  {\centering\large\textbf{Serial System}\\ Upstream Compressor\\[1em]}
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_p1.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:p1}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_sd1.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:sd1}
  \end{subfigure}
  \\
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_td1.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:td1}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_ur1.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:ur1}
  \end{subfigure}
\end{figure}

\begin{figure}
  \ContinuedFloat
  {\centering\large\textbf{Serial System}\\ Downstream Compressor\\[1em]}
  \begin{subfigure}{0.48\linewidth}
    \centering
    \footnotesize
    \input{results/figs/serial_p2.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:p2}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \centering
    \footnotesize
    \input{results/figs/serial_sd2.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:sd2}
  \end{subfigure}
  \\
  \begin{subfigure}{0.48\linewidth}
    \centering
    \footnotesize
    \input{results/figs/serial_td2.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:td2}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \centering
    \footnotesize
    \input{results/figs/serial_ur2.tex}
    \normalsize
    \caption{}
    \label{fig:res:serial-timeresp:ur2}
  \end{subfigure}

  \caption[Time response of serial system.]{Comparison of time responses of centralized and distributed controllers. Distributed controllers use 3 solver iterations. Disturbance applied is a closing of the downstream compressor's discharge valve from 39\% to 29\% at time \u{50}{s}.}
  \label{fig:res:serial-timeresp}
\end{figure}

\begin{figure}
  {\centering\large\textbf{Serial System}\\[1em]}
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_sd1_zoom.tex}
    \normalsize
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.48\linewidth}
    \footnotesize
    \input{results/figs/serial_sd2_zoom.tex}
    \normalsize
  \end{subfigure}
  \caption[Zoom of surge distance time response.]{Zoomed view of surge distance time response given in \fig{res:serial-timeresp}. 
  Disturbance applied is a closing of the downstream compressor's discharge valve from 39\% to 29\% at time \u{50}{s}.}
  \label{fig:res:serial-sd-zoom}
\end{figure}
\fi


